import {
  getData,
  postData,
  putData,
  deleteData,
} from "@/api/common/index";

const baseDatingRegistrationInfo = "/api/dating-registration-info";

const DatingRegistrationInfoUrl = {
  page: "/page",
  exportInfo: "/export",
  url: "",
};

export function getDatingRegistrationInfoPage(params: any, pageNo: number | null | undefined, pageSize : number | null| undefined): Promise<any> {
  let url = baseDatingRegistrationInfo + DatingRegistrationInfoUrl.page + "?pageNum=" + (pageNo ? pageNo : 1) + "&pageSize=" + (pageSize ? pageSize : 10);
  return postData(url, params);
}

export function getDatingRegistrationInfoDetail(id: number): Promise<any> {
  return getData(baseDatingRegistrationInfo + DatingRegistrationInfoUrl.url + "?id=" + id);
}

export function deleteDatingRegistrationInfo(ids: string) : Promise<any>{
  return deleteData(baseDatingRegistrationInfo + DatingRegistrationInfoUrl.url + "?ids=" + ids);
}

export function addOrEditDatingRegistrationInfo(
  method: string,
  params: any
): Promise<any> {
  if ("put" == method) {
    return putData(baseDatingRegistrationInfo + DatingRegistrationInfoUrl.url, params);
  } else {
    return postData(baseDatingRegistrationInfo +  DatingRegistrationInfoUrl.url, params);
  }
}

export function exportDatingRegistration(params: any, response:any): Promise<any> {
  let url = baseDatingRegistrationInfo + DatingRegistrationInfoUrl.exportInfo;
  return postData(url, params, response);
}
